﻿using personalplaner.common.mvvm.factory;
using personalplaner.servicemodel.dataaccess;
using personalplaner.common.mvvm.common;
using personalplaner.gui.common;
using personalplaner.common;

namespace personalplaner.gui.stamm.viewmodels.factories
{
	public class AddDiensteToLayoutModelFactory : IFactory
	{
		#region IFactory Members
		
		public object CreateViewModel(System.Windows.DependencyObject sender)
        {
			var vm = new AddDiensteToLayoutViewModel(sender);

            if (Designer.IsDesignMode)
                return vm;

			vm.ServiceLocator.RegisterService<IAbteilungDataAccess>(new AbteilungDataAccess(SettingsProvider.Settings));
			vm.ServiceLocator.RegisterService<IDiensteDataAccess>(new DiensteDataAccess(SettingsProvider.Settings));
			
            return vm;
		}

		#endregion
	}
}
